A Line chart with adjustable minimum Y value
Minimum Y value:
Maximum Y value:
This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.line.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">[No canvas support]</canvas><br />
Minimum Y value: <input type="text" id="ymin" value="0" style="font-size: 16pt" /><br />
Maximum Y value: <input type="text" id="ymax" value="10" style="font-size: 16pt" />
This is the code that generates the chart:
<script>
window.onload = function ()
{
var line = new RGraph.Line({
id: 'cvs',
data: [5,4,1,6,8,5,3],
options: {
labels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],
gutterLeft: 55,
gutterRight: 35,
gutterBottom: 35,
gutterTop: 35,
title: 'A line chart with adjustable ymin/ymax',
textAccessible: true
}
}).draw();
document.getElementById("ymin").onkeyup = function (e)
{
line.set('ymin', parseInt(e.target.value));
RGraph.redraw();
}
document.getElementById("ymax").onkeyup = function (e)
{
line.set('ymax', parseInt(e.target.value));
RGraph.redraw();
}
};
</script>